Skip to content

Conversation

@krigga
Copy link
Contributor

@krigga krigga commented Sep 19, 2025

No description provided.


`onchain_balance` - (integer) - the balance of a jetton wallet or a transfer amount as reported by `get_wallet_data()` call on the jetton wallet or in onchain data

`displayed_balance` - (integer) - the equivalent amount that should be displayed in UIs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds imprecise; after all, not even nanoTON amount is displayed in UIs as is. Maybe do a [int userfacing_numerator, int userfacing_denominator], or a fixed-point fraction (with denominator of either 2^64, 2^128 or 10^18)?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

muldiv internally uses 513 bits for calculation instead of 257. And standard is not limited to this. Arbitrary implementation may include numerator/denominator. The key point here is that we delegate this logic to the contract implementation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text/0000-scaled-ui-jettons.md

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ProgramCrafter I have added a remark to hopefully resolve the confusion around the usage of decimals.

@mr-tron
Copy link

mr-tron commented Sep 23, 2025

I see two problems in this TEP.

  1. How it should be displayed in user history? For example somebody had 100 real token and multiplier was x2 so wallet displayed him 200. Ok. He send 100 to his friend (real 50). I think wallet should displayed 100 outgoing tokens in history. But few days later multiplicator was updated and now it x4. What wallet should displayed in history? Still 100? But it creates big problem for indexer because it need to calculate master state at the moment of transfer transaction. And I even don't touch problem what jetton transfer in ton has two transactions and master state can be changed between them.
  2. Potential DDoS to wallet infrastructure. Now indexer calculates jetton balances one time (on last transaction) and on then you requests list of jetton balances it's one select to database select jetton, balance from jetton_wallet where owner = $account . But with new standard on every balance request server should make tvm call on every jetton with this feature. So i just need to deploy 1000 Scaled UI jettons and send them to someone and his request for balances 1) becomes very slow 2) need a lot of computations.

@ProgramCrafter
Copy link

This is elegantly solved by requiring custom payload to contain the active multiplier. This solution also has the side benefit of supporting true rebase jettons, but its drawback is that it starts prying into custom payload contents.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text/0000-scaled-ui-jettons.md

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


`onchain_balance` - (integer) - the balance of a jetton wallet or a transfer amount as reported by `get_wallet_data()` call on the jetton wallet or in onchain data

`displayed_balance` - (integer) - the equivalent amount that should be displayed in UIs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text/0000-scaled-ui-jettons.md

They MUST additionally (w.r.t. TEP-74) support the following get methods:
1. `get_supply_data()` returns `(int total_onchain_supply, int total_displayed_supply)`

`total_onchain_supply` - (integer) - the sum of balances of jetton wallets of this jetton master (as reported by `get_wallet_data()` calls on the jetton wallets)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be equal to the total_supply field from the get_jetton_data, shouldn't it? If so I propose to return only the total_displayed_supply here and reuse existing get method. Otherwise developers could create implementation which returns different values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should, and I will rewrite the text to say so. However I think returning both values at the same time is necessary so as to avoid a situation where one get method returns a value from state A and the next call to another get method returns a value from state B, resulting in inconsistent calculations.

@Kaladin13
Copy link

Potential DDoS to wallet infrastructure. Now indexer calculates jetton balances one time (on last transaction) and on then you requests list of jetton balances it's one select to database select jetton, balance from jetton_wallet where owner = $account . But with new standard on every balance request server should make tvm call on every jetton with this feature. So i just need to deploy 1000 Scaled UI jettons and send them to someone and his request for balances 1) becomes very slow 2) need a lot of computations.

I guess indexers could apply the same approach to this as with regular jetton balances - index latest multiplier change on master contract (if we accept this TEP then we can detect it) and store it for corresponding jetton. With this, retrieving balance for user will still be one select, without the need to run tvm call every time.

@krigga
Copy link
Contributor Author

krigga commented Sep 25, 2025

@mr-tron @Kaladin13 I have changed the TEP to hopefully allow for a simpler indexer implementation

@chakzefir
Copy link

What about existing Jetton contracts? Should we consider implementing a workaround to give them the same level of visibility in the interfaces?

@krigga
Copy link
Contributor Author

krigga commented Oct 13, 2025

What about existing Jetton contracts? Should we consider implementing a workaround to give them the same level of visibility in the interfaces?

In a similar way to TEP-89?

(quote from TEP-89)

For non-upgradable Jetton Master with updatable metadata it is recommended to add "wallet-discovery" key with value equal to text representaion of Jetton Discovery contract address.


Jetton master contracts supporting this TEP MUST send the following external-out message (TL-B structure) whenever the values returned by `get_display_multiplier()`:
```
display_multiplier_changed#ac392598 numerator:(VarUInteger 32) denominator:(VarUInteger 32) {n:#} comment:(Maybe (SnakeData ~n)) = ExternalOutMsgBody;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong scheme. should be

display_multiplier_changed#ac392598 numerator:(VarUInteger 32) denominator:(VarUInteger 32) {n:#} comment:(Maybe (SnakeData n)) = ExternalOutMsgBody n;

or better

display_multiplier_changed#ac392598 numerator:(VarUInteger 32) denominator:(VarUInteger 32) comment:(Maybe SnakeString) = ExternalOutMsgBody;

(SnakeString probably gonna be added to tlbc soon, yet it's on this branch. your SnakeData type is not defined anyway)

chore: update external-out schema
chore: replace TBDs
@krigga
Copy link
Contributor Author

krigga commented Oct 23, 2025

What about existing Jetton contracts? Should we consider implementing a workaround to give them the same level of visibility in the interfaces?

I have added this into the standard, however I am now being told by multiple members of the community that this is not a good addition.

I invite the community to discuss this and/or vote on whether this feature should be removed (specifically, these lines https://github.com/ton-blockchain/TEPs/pull/526/files#diff-837a6387eab3bd4d428b9d6a741cf8f2e14dd62adee63ab40c0eada0c73c37a4R56-R58).

Please leave a 👍 reaction to vote for REMOVAL of the feature, and 👎 to vote to LEAVE/INCLUDE the feature in the standard.

@ton-blockchain ton-blockchain deleted a comment from Rastakhcarbon Nov 13, 2025
Copy link

@mr-tron mr-tron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@EmelyanenkoK EmelyanenkoK merged commit 174817a into ton-blockchain:master Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants